package com.rxt.controller;


import com.rxt.common.result.Result;
import com.rxt.model.domain.FBankUser;
import com.rxt.model.dto.UUserDto;
import com.rxt.model.vo.BankUserLoginVo;
import com.rxt.model.vo.BankUserVo;
import com.rxt.model.vo.LoginVo;
import com.rxt.model.vo.PasswordVo;
import com.rxt.service.IFBankService;
import com.rxt.service.IFBankUserService;
import com.rxt.service.IUUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 周梓文
 * @since 2023-08-24
 */
@Api(tags = "银行用户登录模块")
@RestController
@RequestMapping("/fBankUser")
public class FBankUserController {

    @Autowired
    private IFBankUserService ifBankUserService;


    @ApiOperation("用户登录")
    @PostMapping("/login")
    public Result login(@RequestBody BankUserLoginVo bankUserVo) {
        return ifBankUserService.login(bankUserVo);
    }

    @ApiOperation("添加用户信息")
    @PostMapping("/save")
    public Result saveInfo(@RequestBody BankUserVo bankUserVo) {
        return ifBankUserService.saveUser(bankUserVo);
    }

    @ApiOperation("获取当前用户信息")
    @GetMapping("/me")
    public Result me() {
        return ifBankUserService.currentUser();
    }

    @ApiOperation("重置密码")
    @PostMapping("/resetPwd")
    public Result resetPwd(@RequestBody PasswordVo pwdVo) {
        return ifBankUserService.resetPwd(pwdVo);
    }

    @ApiOperation("更新用户信息")
    @PostMapping("/update")
    public Result updateUserInfo(@RequestBody BankUserVo bankUserVo) {
        return ifBankUserService.updateUserInfo(bankUserVo);
    }

    @ApiOperation("退出登录")
    @GetMapping("/logout")
    public Result logout() {
        return ifBankUserService.logout();
    }

}

